import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpDaily {
  id!: number;
  title!: string;
  img?: unknown;
  content?: unknown;
  audioId?: number;
  audioUrl?: unknown;
  audioTitle?: unknown;
  audioDuration?: string;
  lecturerId?: number;
  term?: number;
  time?: string;
  style?: number;
  isExamine?: boolean;
  state!: boolean;
  views: number = 0;
  addTime!: string;
  updateTime!: string;
  uniacid!: number;
}

export const ImsYzdKpDailySchema = new EntitySchema({
  class: ImsYzdKpDaily,
  properties: {
    id: { primary: true, type: 'number' },
    title: { type: 'string', length: 255 },
    img: { type: 'unknown', columnType: 'longtext', nullable: true },
    content: { type: 'unknown', columnType: 'longtext', nullable: true },
    audioId: { type: 'number', nullable: true },
    audioUrl: { type: 'unknown', columnType: 'longtext', nullable: true },
    audioTitle: { type: 'unknown', columnType: 'longtext', nullable: true },
    audioDuration: { type: 'string', length: 255, nullable: true },
    lecturerId: { type: 'number', nullable: true },
    term: { type: 'number', nullable: true },
    time: { type: 'string', length: 255, nullable: true },
    style: { type: 'number', nullable: true },
    isExamine: { type: 'boolean', nullable: true },
    state: { type: 'boolean' },
    views: { type: 'number', default: 0 },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
    uniacid: { type: 'number' },
  },
});
